package com.lh.runmanage.service.Impl;

import com.lh.runmanage.dao.SystemUserMapper;
import com.lh.runmanage.model.InPutParam.SystemUserInParam;
import com.lh.runmanage.model.InPutParam.SystemUserP2InParam;
import com.lh.runmanage.service.SystemUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ：梁昊，后端工程师：梁昊
 * @create 2021-07-23 15:58
 * @function
 * @editLog
 */
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Service
public class SystemUserServiceImpl implements SystemUserService {
    @Autowired
    SystemUserMapper systemUserMapper;

    /**
     * 展示端方法：U3
     *
     * @param systemUserInParam com.lh.runmanage.model.InPutParam.SystemUserInParam
     * @return 得到项目信息与标定、分值信息
     */
    @Override
    public int selectSystemUserByProjectIdOrCreateData(SystemUserInParam systemUserInParam) {
        Integer integer = systemUserMapper.selectSystemUserByProjectIdOrCreateData(systemUserInParam);
        return integer != null ? integer : 0;
    }

    @Override
    public int selectSystemUserMaxByProjectIdOrCreateData(SystemUserInParam systemUserInParam) {
        Integer integer = systemUserMapper.selectSystemUserMaxByProjectIdOrCreateData(systemUserInParam);
        return integer != null ? integer : 0;
    }

    /**
     * 展示端方法：P2
     *
     * @param systemUserP2InParam com.lh.runmanage.model.InPutParam.SystemUserP2InParam
     * @return 用户同比率
     */
    @Override
    public int selectSystemUserSameCount(SystemUserP2InParam systemUserP2InParam) {
        final Integer integer = systemUserMapper.selectSystemUserSameCount(systemUserP2InParam);
        if (integer != null)
            return integer;
        else
            return 0;
    }

}